From b95ed3d13d05a38df866636a2049b003d90b6de3 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Fri, 27 Mar 2020 16:29:14 -0600 Subject: [PATCH] migrate to travis-ci.com (#526) * get qt installs working to load cache. * update to travis-ci.com for github release build log links. --- tools/qtci/install-qt | 62 ++++++++++++++++++++++++++++++++ tools/travis_install_linux_local | 7 ++-- tools/travis_install_osx | 7 ++-- tools/uploadtool/upload.sh | 2 +- 4 files changed, 73 insertions(+), 5 deletions(-) create mode 100755 tools/qtci/install-qt diff --git a/tools/qtci/install-qt b/tools/qtci/install-qt new file mode 100755 index 000000000..1b1f4f328 --- /dev/null +++ b/tools/qtci/install-qt @@ -0,0 +1,62 @@ +#!/bin/bash -e +# Reference: +# https://github.com/musescore/MuseScore/blob/master/build/travis/job_macos/install.sh + +QT_VERSION=${1:-5.12.0} +QT_TARGET_CATALOG=${2:-$PWD} +QT_CI_DOWNLOADER=${QT_CI_DOWNLOADER:-"wget -c -N"} + +QT_MAJOR_VERSION=$(echo ${QT_VERSION} | cut -d "." -f 1) +QT_MINOR_VERSION=$(echo ${QT_VERSION} | cut -d "." -f 2) +if [ "$(uname)" = "Darwin" ]; then + if { [ "${QT_MAJOR_VERSION}" -eq 5 ] && [ "${QT_MINOR_VERSION}" -ge 9 ]; } || [ "${QT_MAJOR_VERSION}" -ge 6 ]; then + # this was good from 5.9.0 through at least 5.12.0 + DOWNLOAD_URL=https://download.qt.io/archive/qt/${QT_MAJOR_VERSION}.${QT_MINOR_VERSION}/${QT_VERSION}/qt-opensource-mac-x64-${QT_VERSION}.dmg + else + # this was good from 5.2.1 through 5.8.0 + DOWNLOAD_URL=https://download.qt.io/archive/qt/${QT_MAJOR_VERSION}.${QT_MINOR_VERSION}/${QT_VERSION}/qt-opensource-mac-x64-clang-${QT_VERSION}.dmg + fi + COMPILER=clang_64 +elif [ "$(uname)" = "Linux" ]; then + # this was good from 5.2.1 through at least 5.12.0 + DOWNLOAD_URL=https://download.qt.io/archive/qt/${QT_MAJOR_VERSION}.${QT_MINOR_VERSION}/${QT_VERSION}/qt-opensource-linux-x64-${QT_VERSION}.run + COMPILER=gcc_64 +else + echo "Unsupported system." >&2 + exit 1 +fi +INSTALLER=$(basename $DOWNLOAD_URL) +ENVFILE=${QT_TARGET_CATALOG}/qt-${QT_VERSION}.env + +echo Downloading Qt +${QT_CI_DOWNLOADER} ${DOWNLOAD_URL} || exit 1 + +echo Installing Qt +if [ "$(uname)" = "Darwin" ]; then + INSTALLER_NAME=${INSTALLER%.*} + APPFILE=/Volumes/${INSTALLER_NAME}/${INSTALLER_NAME}.app/Contents/MacOS/${INSTALLER_NAME} + hdiutil attach ${PWD}/${INSTALLER} + sandbox-exec -n no-network extract-qt-installer $APPFILE ${QT_TARGET_CATALOG}/Qt + # workaround apparent exit of extract-qt-installer before finished, + # which results in hdiutil "hdiutil: couldn't unmount "disk1" - Resource busy" + # and the install resources not being available. + #hdiutil detach /Volumes/${INSTALLER_NAME} + count=0 + until hdiutil detach /Volumes/${INSTALLER_NAME} || [ $count -ge 12 ] + do + echo "Wait and attempt to detach again" + count=`expr $count + 1` + sleep 5 + done +elif [ "$(uname)" = "Linux" ]; then + unshare -r -n extract-qt-installer ${PWD}/${INSTALLER} ${QT_TARGET_CATALOG}/Qt +fi + +echo Create ${ENVFILE} +if [ -d "${QT_TARGET_CATALOG}/Qt/${QT_VERSION}/${COMPILER}/bin" ]; then + echo "export PATH=${QT_TARGET_CATALOG}/Qt/${QT_VERSION}/${COMPILER}/bin:$PATH" > ${ENVFILE} +elif [ -d "${QT_TARGET_CATALOG}/Qt/${QT_MAJOR_VERSION}.${QT_MINOR_VERSION}/${COMPILER}/bin" ]; then + # some packages use an abbreviated version x.y in the path instead of x.y.z + echo "export PATH=${QT_TARGET_CATALOG}/Qt/${QT_MAJOR_VERSION}.${QT_MINOR_VERSION}/${COMPILER}/bin:$PATH" > ${ENVFILE} +fi + diff --git a/tools/travis_install_linux_local b/tools/travis_install_linux_local index 82d419881..9544a472a 100755 --- a/tools/travis_install_linux_local +++ b/tools/travis_install_linux_local @@ -49,9 +49,12 @@ if [ -d "${QTDIR}/bin" ]; then else rm -fr ${CACHEDIR} mkdir -p ${CACHEDIR} - QT_CI_DOWNLOADER="wget -nv -c" PATH=${TRAVIS_BUILD_DIR}/tools/qtci:${PATH} install-qt-online "qt.qt5.${QT_VERSION_SHORT}.gcc_64,qt.qt5.${QT_VERSION_SHORT}.qtwebengine" ${CACHEDIR} - echo "export PATH=${QTDIR}/bin:$PATH" > ${CACHEDIR}/qt-${QT_VERSION}.env + pushd ${CACHEDIR} + # install-qt creates the install at $PWD/Qt. + QT_CI_PACKAGES=qt.qt5.${QT_VERSION_SHORT}.gcc_64,qt.qt5.${QT_VERSION_SHORT}.qtwebengine QT_CI_DOWNLOADER="wget -nv -c" PATH=${TRAVIS_BUILD_DIR}/tools/qtci:${PATH} install-qt ${QT_VERSION} + popd validate + rm ${CACHEDIR}/qt-opensource*.run fi # prepare locale for test_encoding_latin1, requires locales package. diff --git a/tools/travis_install_osx b/tools/travis_install_osx index 26c4d6b03..3b4fa8566 100755 --- a/tools/travis_install_osx +++ b/tools/travis_install_osx @@ -49,7 +49,10 @@ if [ -d "${QTDIR}/bin" ]; then else rm -fr ${CACHEDIR} mkdir -p ${CACHEDIR} - QT_CI_DOWNLOADER="wget -nv -c" PATH=${TRAVIS_BUILD_DIR}/tools/qtci:${PATH} install-qt-online "qt.qt5.${QT_VERSION_SHORT}.clang_64,qt.qt5.${QT_VERSION_SHORT}.qtwebengine" "${CACHEDIR}" 3.1.1 - echo "export PATH=${QTDIR}/bin:$PATH" > ${CACHEDIR}/qt-${QT_VERSION}.env + pushd ${CACHEDIR} + # install-qt creates the install at $PWD/Qt. + QT_CI_PACKAGES=qt.qt5.${QT_VERSION_SHORT}.clang_64,qt.qt5.${QT_VERSION_SHORT}.qtwebengine QT_CI_DOWNLOADER="wget -nv -c" PATH=${TRAVIS_BUILD_DIR}/tools/qtci:${PATH} install-qt ${QT_VERSION} + popd validate + rm ${CACHEDIR}/qt-opensource*.dmg fi diff --git a/tools/uploadtool/upload.sh b/tools/uploadtool/upload.sh index 771cc161e..5c8ec8bba 100755 --- a/tools/uploadtool/upload.sh +++ b/tools/uploadtool/upload.sh @@ -156,7 +156,7 @@ if [ "$TRAVIS_COMMIT" != "$target_commit_sha" ] ; then if [ ! -z "$TRAVIS_JOB_ID" ] ; then if [ -z "${UPLOADTOOL_BODY+x}" ] ; then # TODO: The host could be travis-ci.org (legacy open source) or travis-ci.com (subscription or latest open source). - BODY="Travis CI build log: https://travis-ci.org/$REPO_SLUG/builds/$TRAVIS_BUILD_ID/" + BODY="Travis CI build log: https://travis-ci.com/$REPO_SLUG/builds/$TRAVIS_BUILD_ID/" else BODY="$UPLOADTOOL_BODY" fi -- 2.30.2